package com.wali.modules.usr.bo;

import com.wali.modules.usr.vo.UsrSenderVO;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author walixu
 * @ClassName com.wali.modules.common.vo
 * @Description 发件人信息BO类
 * @email wali.xu@kpmg.com
 * @date 19/01/2019 2:14 下午
 */
public class UsrSenderBO implements Serializable {

    /**
     * 主键
     */
    private int id;

    /**
     * 用户ID
     */
    private int userId;

    /**
     * 仓库名称
     */
    private String senderName;

    /**
     * 电话
     */
    private String senderTelphone;

    /**
     * 地址
     */
    private String senderAddr;

    /**
     * 邮编
     */
    private String postcode;

    /**
     * 创建时间
     */
    private String createTime;

    /**
     * 更新时间
     */
    private String updateTime;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getSenderName() {
        return senderName;
    }

    public void setSenderName(String senderName) {
        this.senderName = senderName;
    }

    public String getSenderTelphone() {
        return senderTelphone;
    }

    public void setSenderTelphone(String senderTelphone) {
        this.senderTelphone = senderTelphone;
    }

    public String getSenderAddr() {
        return senderAddr;
    }

    public void setSenderAddr(String senderAddr) {
        this.senderAddr = senderAddr;
    }

    public String getPostcode() {
        return postcode;
    }

    public void setPostcode(String postcode) {
        this.postcode = postcode;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        UsrSenderBO that = (UsrSenderBO) o;
        return id == that.id &&
                userId == that.userId &&
                Objects.equals(senderName, that.senderName) &&
                Objects.equals(senderTelphone, that.senderTelphone) &&
                Objects.equals(senderAddr, that.senderAddr) &&
                Objects.equals(postcode, that.postcode) &&
                Objects.equals(createTime, that.createTime) &&
                Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userId, senderName, senderTelphone, senderAddr, postcode, createTime, updateTime);
    }

    @Override
    public String toString() {
        return "UsrSenderBO{" +
                "id=" + id +
                ", userId=" + userId +
                ", senderName='" + senderName + '\'' +
                ", senderTelphone='" + senderTelphone + '\'' +
                ", senderAddr='" + senderAddr + '\'' +
                ", postcode='" + postcode + '\'' +
                ", createTime='" + createTime + '\'' +
                ", updateTime='" + updateTime + '\'' +
                '}';
    }

    /**
     * @param
     * @return
     * @throws
     * @Title convert
     * @Description 将UsrSenderBO转化为UsrSenderVO
     */
    public static UsrSenderVO convert(UsrSenderBO usrSender) {
        UsrSenderVO temp = new UsrSenderVO();
        temp.setId(usrSender.getId());
        temp.setUserId(usrSender.getUserId());
        temp.setAddr(usrSender.getSenderAddr());
        temp.setCreateTime(usrSender.getCreateTime());
        temp.setName(usrSender.getSenderName());
        temp.setPostcode(usrSender.getPostcode());
        temp.setTelphone(usrSender.getSenderTelphone());
        temp.setUpdateTime(usrSender.getUpdateTime());
        return temp;
    }
}
